package com.xxxx.yoyo.adminweb;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.xxxx.yoyo.bean.Type;
import com.xxxx.yoyo.service.ITypeService;
import com.xxxx.yoyo.service.impl.TypeServiceImpl;


@WebServlet("/admin/typeList")
public class TypeListServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private ITypeService typeService = new TypeServiceImpl();
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//设置导航条[宠物大类管理]处于选中状态
		request.setAttribute("flag", 4);
		
		//获取[宠物分类]列表
		List<Type> typeList = typeService.getTypeList ();
		//把typeList存入request中，供/admin/type list.jsp使用
		request.setAttribute("typeList", typeList);
		
		//请求转发，跳转到/admin/type list.jsp
		request.getRequestDispatcher("/admin/type_list.jsp").forward(request,response);
		
	}

}
